package top.codingfly.model.resp.common;

import java.io.Serializable;

public class Response<T> implements Serializable {
    public Integer code;
    public String message;
    public T data;
    public Response() { }
    public Response(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public Integer getCode() {
        return code;
    }
    public void setCode(Integer code) {
        this.code = code;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public T getData() {
        return data;
    }
    public void setData(T data) {
        this.data = data;
    }
    public static <T> Response<T> success() {
        return new Response(200, "success", null);
    }
    public static <T> Response<T> success(T data) {
        return new Response(200, "success", data);
    }
    public static <T> Response<T> error(String message) {
        return new Response(500, message, null);
    }
}